home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue36 / Clinic / IDESetU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-03-28  |  1.4 KB  |  71 lines

  1. unit IDESetU;
  2.  
  3. interface
  4.  
  5. uses
  6. {$ifdef Win32}
  7.   Registry,
  8. {$else}
  9.   Inifiles,
  10. {$endif}
  11.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  12.   StdCtrls;
  13.  
  14. type
  15.   TForm1 = class(TForm)
  16.     CD: TColorDialog;
  17.     btnTooltip: TButton;
  18.     btnProp: TButton;
  19.     procedure FormCreate(Sender: TObject);
  20.     procedure FormDestroy(Sender: TObject);
  21.     procedure btnTooltipClick(Sender: TObject);
  22.     procedure btnPropClick(Sender: TObject);
  23.   private
  24.   {$ifdef Win32}
  25.     Ini: TRegIniFile;
  26.   {$else}
  27.     Ini: TIniFile;
  28.   {$endif}
  29.   end;
  30.  
  31. var
  32.   Form1: TForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.DFM}
  37.  
  38. procedure TForm1.FormCreate(Sender: TObject);
  39. begin
  40. {$ifdef Win32}
  41.   Ini := TRegIniFile.Create('Software\Borland\Delphi\3.0');
  42. {$else}
  43.   Ini := TIniFile.Create('Delphi.Ini');
  44. {$endif}
  45. end;
  46.  
  47. procedure TForm1.FormDestroy(Sender: TObject);
  48. begin
  49.   Ini.Free
  50. end;
  51.  
  52. procedure TForm1.btnTooltipClick(Sender: TObject);
  53. begin
  54.   CD.Color := StrToInt(Ini.ReadString(
  55.     'Globals', 'HintColor', IntToStr(Application.HintColor)));
  56.   if CD.Execute then
  57.     Ini.WriteString('Globals', 'HintColor',
  58.       Format('$%x', [CD.Color]))
  59. end;
  60.  
  61. procedure TForm1.btnPropClick(Sender: TObject);
  62. begin
  63.   CD.Color := StrToInt(Ini.ReadString(
  64.     'Globals', 'PropValueColor', IntToStr(clWindowText)));
  65.   if CD.Execute then
  66.     Ini.WriteString('Globals', 'PropValueColor',
  67.       Format('$%x', [CD.Color]))
  68. end;
  69.  
  70. end.
  71.